﻿//************************************************************************************************
// Copyright © 2012 Steven M. Cohn. All Rights Reserved.
//
// Facility:	Microsoft Development Environment 2012  Version 11.0.50727.1
// Environment:	Microsoft .NET Framework 4.5            Version v4.0.30319
//
// Description: The CookieChipper main
//
// Revision History:
// -Who--------------- -When---------- -What------------------------------------------------------
// Steven M. Cohn		27-Nov-2012		New
//************************************************************************************************

namespace CookieChipper
{
	using System;
	using System.Xml.Linq;
	using System.Windows.Forms;


	internal partial class UpgradeWindow : OptionalForm
	{
		private string releaseUrl;


		public UpgradeWindow ()
		{
			InitializeComponent();
		}


		public UpgradeWindow (UpgradeRelease release)
			: this()
		{
			currentBox.Text = release.CurrentVersion.ToString();
			newBox.Text = release.ReleaseVersion.ToString();

			string xml = release.Description
				.Replace("<br/>", Environment.NewLine)
				.Replace("<li/>", Environment.NewLine);

			var root = XElement.Parse("<root>" + xml + "</root>");

			notesBox.Text = root.Value;

			releaseUrl = release.Uri;
		}


		public string ReleaseUrl
		{
			get { return releaseUrl; }
		}


		private void DoVisit (object sender, EventArgs e)
		{
			this.Close();
		}
	}
}
